let nunjucks = require("nunjucks")

function createEnv(path,opts) {
    path = path || "views";
    opts = opts || {}
    let optsIng={

    };
    let env = nunjucks.configure(path,optsIng)
    return env
}

module.exports=async(ctx,next)=>{
    let env = createEnv();
    ctx.render=function (view,model) {
        ctx.body = env.render(view,model)
    }
    await next();
}